package com.base.cn.platform.os.controller.mobile.op.feedback;

import com.base.cn.platform.os.common.MobileBaseController;
import com.base.cn.platform.os.service.manage.op.feedback.OpFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;

/**
 * H5用户反馈controller
 *
 * @author zsw
 * @create 2018-06-13
 */
@Controller
@RequestMapping("/mobile/uc/op/feedback")
public class MobileFeedbackController extends MobileBaseController {

    @Autowired
    private OpFeedbackService feedbackService;

    /**
     * 跳转到反馈页面
     *
     * @param request
     * @return
     */
    @RequestMapping("/feedbackIndex")
    public String feedbackIndex(HttpServletRequest request){
        return resultPage("/op/feedback/u-feedback");
    }

    /**
     * 添加反馈
     *
     * @param request
     * @param feedBack
     * @return
     */
    @RequestMapping("/saveUpdateFeedBack")
    @ResponseBody
    public Map<String,Object> saveUpdateFeedBack(HttpServletRequest request,
                                                 @RequestBody Map<String,Object> feedBack){
        BigDecimal loginUserId = webMobileLoginUtil.getLoginUserId(request);
        feedBack.put("userId",loginUserId);
        return feedbackService.saveUpdateFeedback(feedBack);
    }
}
